import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class demo3 {
    public int cutOffTree(List<List<Integer>> forest) {
        //用来存排好序的下标
        List<int[]>list=new ArrayList<>();
        int m=list.size();
        int n=list.get(0).length;
        for (int i = 0; i <m ; i++) {
            for (int j = 0; j <n ; j++) {
                if(forest.get(i).get(j)>1)list.add(new int[]{i,j});
            }
        }
        Collections.sort(list,(l1,l2)->{
            return forest.get(l1[0]).get(l1[1])-forest.get(l2[0]).get(l2[1]);
        });
        
    }
}
